import 'package:flutter/material.dart';
import 'package:flutter_snail/ui/style/snail_text_style.dart';

class CategoryItem extends StatelessWidget {
  const CategoryItem({
    Key? key,
    required this.index,
    this.alignment = Alignment.topLeft,
    required this.child,
  }) : super(key: key);

  final int index;
  final Alignment alignment;
  final Widget child;

  @override
  Widget build(BuildContext context) {
    return AspectRatio(
      aspectRatio: 1.0,
      child: Container(
        decoration: BoxDecoration(
          borderRadius: BorderRadius.circular(10),
          color: colors[index % 4],
        ),
        padding: const EdgeInsets.all(5),
        child: Align(alignment: alignment, child: child),
      ),
    );
  }

  List<Color> get colors =>
      [Colors.red, Colors.orange, Colors.green, Colors.blue];
}
